package com.youthburin.base.taglib;

import org.apache.shiro.web.tags.PermissionTag;

public class HasAnyPermissionTag extends PermissionTag {
	private static final long serialVersionUID = 1L;
	private static final String ROLE_NAMES_DELIMETER = ",";

	@Override
	protected boolean showTagBody(String pemissionNames) {
		boolean hasAnyPermission = false;

		for (String permission : pemissionNames.split(ROLE_NAMES_DELIMETER)) {

			if (isPermitted(permission.trim())) {
				hasAnyPermission = true;
				break;
			}

		}

		return hasAnyPermission;
	}

}
